package cn.com.springsource.ioc.lifecyclecallback;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component("indexDao")
@Lazy  //懒加载
public class IndexDaoImpl implements IndexDao , InitializingBean, DisposableBean {

    public void test() {
        System.out.println("IndexDao...test...");
    }

    @PostConstruct
    public void init(){
        System.out.println("init...PostConstruct");
    }

    @PreDestroy
    public void destroyBean(){
        System.out.println("destroyBean...PreDestroy");
    }



    public void afterPropertiesSet() throws Exception {
        System.out.println("IndexDao...afterPropertiesSet...InitializingBean...");
    }

    public void destroy() throws Exception {
        System.out.println("IndexDao...destroy...DisposableBean...");
    }
}
